import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserOutInvestVO, UserOutInvestForm, UserOutInvestQuery } from '@/api/business/userOutInvest/types';

/**
 * 查询用户外部投资记录列表
 * @param query
 * @returns {*}
 */

export const listUserOutInvest = (query?: UserOutInvestQuery): AxiosPromise<UserOutInvestVO[]> => {
  return request({
    url: '/business/userOutInvest/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户外部投资记录详细
 * @param id
 */
export const getUserOutInvest = (id: string | number): AxiosPromise<UserOutInvestVO> => {
  return request({
    url: '/business/userOutInvest/' + id,
    method: 'get'
  });
};

/**
 * 新增用户外部投资记录
 * @param data
 */
export const addUserOutInvest = (data: UserOutInvestForm) => {
  return request({
    url: '/business/userOutInvest',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户外部投资记录
 * @param data
 */
export const updateUserOutInvest = (data: UserOutInvestForm) => {
  return request({
    url: '/business/userOutInvest',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户外部投资记录
 * @param id
 */
export const delUserOutInvest = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/userOutInvest/' + id,
    method: 'delete'
  });
};
